// 导入二次封装axios
import koi from "@/utils/axios.ts";

// 统一管理接口
enum API {
  ALL_ARTICLE = "/backstage/article",
  GET_ARTICLE_BY_ID = "/backstage/article/",
  UPDATE_ARTICLE = "/backstage/article",
  DELETE_ARTICLE = "/backstage/article",
  // 通过title查询文章
  GET_ARTICLE_BY_TITLE = "/backstage/article/getArticleString",
  // 通过title获取文章id和信息
  GET_ARTICLE_BY_TITLE_ID = "/backstage/article/articleInfoSearch"
}

// 分页获取所有的文章
export const getAllArticle = (data: any) => koi.get(API.ALL_ARTICLE, data);
// 根据id获取
export const getArticleById = (id: any) => koi.get(API.ALL_ARTICLE + "/" + id);
// 更新文章
export const updateArticle = (data: any) => koi.put(API.UPDATE_ARTICLE, data);
// 新增文章
export const addArticle = (data: any) => koi.post(API.ALL_ARTICLE, data);
// 删除文章
export const deleteArticle = (ids: any) => koi.delete(API.DELETE_ARTICLE, { data: ids });
// 通过title查询文章
export const getArticleByTitle = (title: any) => koi.get(API.GET_ARTICLE_BY_TITLE + "/" + title);
// 通过title获取文章id和信息
export const getArticleByTitleId = (title: any) => koi.get(API.GET_ARTICLE_BY_TITLE_ID + "/" + title);
